home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
5_9.lha
/
5_9
/
5_9c4.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
570b
|
31 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
ain(int argc, char **argv)
srand(1); // DELETE
if (argc != 3)
error("two arguments expected");
int count = 0;
int m = atoi(argv[1]); // number of set members
int n = atoi(argv[2]); // in the range 1..n
intset s;
set_is(s, m, n);
while (count < m)
{
int t = randint(n);
if (member_is(s, t) == 0)
{
insert_is(s, t);
count++;
}
}
print_in_order(&s);
delete_is(s);
return 0;